package org.jeecg.modules.ncmeapis.processTest.business.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.ncmeapis.processTest.processDefinition.overtime.OvertimeProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Api(tags = "加班流程")
//@BusinessApi
//@RestController
@RequestMapping("/demo/overtime")
@Slf4j
public class OvertimeController {

    @Autowired
    private OvertimeProcess overtimeProcess;

    @ApiOperation(value = "1开启加班流程")
    @GetMapping(value = "/startOvertime")
    public Object startOvertime() throws Exception {
        String operator = "孙";
        Integer processId = overtimeProcess.start(operator);
        overtimeProcess.push(processId, operator);
        return "ok，processId: " + processId;
    }

    @ApiOperation(value = "2组长审批")
    @GetMapping(value = "/groupLeaderAgree")
    public Object groupLeaderAgree(@RequestParam Integer processId) throws Exception {
        String operator = "江涛";
        overtimeProcess.push(processId, operator);
        return "ok";
    }

    @ApiOperation(value = "3院长审批")
    @GetMapping(value = "/deanAgree")
    public Object deanAgree(@RequestParam Integer processId) throws Exception {
        String operator = "院长";
        overtimeProcess.push(processId, operator);
        return "ok";
    }

    @ApiOperation(value = "4-1请假存档-档案管理员")
    @GetMapping(value = "/recordEventApply")
    public Object recordEventApply(@RequestParam Integer processId) throws Exception {
        overtimeProcess.push(processId, "档案管理员");
        return "ok";
    }

    @ApiOperation(value = "4-2请假存档-小静")
    @GetMapping(value = "/recordEventApply2")
    public Object recordEventApply2(@RequestParam Integer processId) throws Exception {
        overtimeProcess.push(processId, "小静");
        return "ok";
    }

}